package com.nami.conver.application.pmsg;

import com.nami.conver.application.convertor.Cmd2DomainConvertor;
import com.nami.conver.domain.pchat.model.UpdConverModel;
import com.nami.conver.domain.pchat.service.PrivateConverDomainService;
import com.nami.conver.facade.pmsg.PrivateConverFacade;
import com.nami.conver.facade.pmsg.request.PrivateConverCmd;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

@Slf4j
@Service
@RequiredArgsConstructor
public class PrivateConverFacadeImpl implements PrivateConverFacade {

    private final PrivateConverDomainService converDomainService;

    @Override
    public void execute(PrivateConverCmd request) {
        UpdConverModel conver = Cmd2DomainConvertor.toDomain(request);
        converDomainService.refreshConver(conver);
        conver.setRevert(true);
        converDomainService.refreshConver(conver);
    }

}
